package com.dhl.decorated;

import com.dhl.decorated.mycoffee.DeCaf;
import com.dhl.decorated.mycoffee.LongBack;
import com.dhl.decorated.mydecorated.Milk;
import com.dhl.decorated.mydecorated.Soy;

import java.io.DataInputStream;
import java.io.FileInputStream;

/**
 * @title: CoffeeBar
 * @Author danghailiang
 * @Date: 2022/8/3 22:06
 * @Version 1.0
 */
public class CoffeeBar {
    public static void main(String[] args) throws Exception {

        // LongBack咖啡
        Drink longBack = new LongBack();
        System.out.println("longBack费用:" + longBack.cost());;
        System.out.println("longBack描述:" + longBack.getDes());

        Drink soy = new Soy(longBack);
        System.out.println("longBack费用:" + soy.cost());;
        System.out.println("longBack描述:" + soy.getDes());


        Drink milke = new Milk(soy);
        System.out.println("longBack费用:" + milke.cost());;
        System.out.println("longBack描述:" + milke.getDes());
        System.out.println("------------------------------------------------");

        Drink deCaf = new DeCaf();
        System.out.println("deCaf费用:" + deCaf.cost());;
        System.out.println("deCaf描述:" + deCaf.getDes());
        Drink milke1 = new Milk(deCaf);
        System.out.println("longBack费用:" + milke1.cost());;
        System.out.println("longBack描述:" + milke1.getDes());
        Drink milke2 = new Milk(milke1);
        System.out.println("longBack费用:" + milke2.cost());;
        System.out.println("longBack描述:" + milke2.getDes());
        // 装饰者	---	 DataInputStream dis：		被装饰者 --- new FileInputStream("F:\\a.txt")
        DataInputStream dis = new DataInputStream(new FileInputStream("F:\\a.txt"));
        System.out.println(dis.read());
        dis.close();
    }
}
